/* Simplified example program for F01CTF (Example 1 only) C Version. NAG Copyright 1999. */ #include #include #include #define NROW 4 #define NCOL 3 main() { int ifail = 0, i, j, m, n, mn = NROW*NCOL, lmove = (NROW+NCOL)/2; int move[(NROW+NCOL)/2]; /* Matrix a is loaded in row major order */ double a[NROW][NCOL] = {1.0, 2.5, 3.0, -2.0, 2.0, -1.5, 3.5, 2.0, -2.5, 1.5, -2.0, 1.0}; /* Matrix b is loaded in row major order */ double b[NROW][NCOL] = {2.0, -2.5, -2.0, 1.0, 1.0, 1.0, -1.5, 2.5, -2.5, 2.0, -2.0, 1.0}; double c[NROW][NCOL]; double alpha = 1.0, beta = 1.0; puts("F01CTF Example Program Results"); m = NROW; n = NCOL; /* F01TCF is called with the transpose option specified for a and b. Each character string argument has an extra length argument at the end of the argument list. */ f01ctf_("T", "T", &m, &n, &alpha, (double *) a, &n, &beta, (double *) b, &n, (double *) c, &m, &ifail, 1, 1); /* Result matrix c is in column major order - F01CRF transposes the matrix in place */ f01crf_((double *)c, &m, &n, &mn, move, &lmove, &ifail); /* Print out array c in row major order */ for (i=0; i